package com.jumper.mydemo.my;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

public class MyServiceA  implements BeanNameAware, InitializingBean, DisposableBean {
    @Autowired
    private MyRepository myRepository;

    @Value("${java.home}")
    private String javaHome;

    @Override
    public void destroy() throws Exception {
        System.out.println("MyService.destroy executed");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("MyService.afterPropertiesSet executed");
    }

    @Override
    public void setBeanName(String name) {
        System.out.println("MyService.setBeanName executed");
    }
    
    @Override
    public String toString() {
        return "MyService{" + 
            "myRepository=" + myRepository +
            ", javaHome=\'" + javaHome + "\'" +
        "}";
    }
}
